from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

from config.config import Setting

setting = Setting()


# 暂时只做了数据库初始化，其他初始化也可以加入
DB_URI = f"mysql+pymysql://{setting.USERNAME}:{setting.PASSWORD}@{setting.HOST}:{setting.PORT}/{setting.DBNAME}?charset=utf8"
engine = create_engine(DB_URI, echo=False)
Session = sessionmaker(bind=engine)
dbsession = Session()


whitelist = Setting.WHITELIST

Base = declarative_base(engine)


